﻿using System;
using System.Collections.Generic;
using AccessControl.Contracts.Managers;
using AccessControl.Contracts.Models;
using System.Collections.ObjectModel;
using AccessControl.DataManagers;

namespace AccessControl.Gateway.Managers
{
	class MapsManager : IMapsManager
	{
		#region Fields

		private static MapsManager s_Instance = null;
		private ObservableCollection<IMap> _maps = new ObservableCollection<IMap>();

		#endregion

		#region Private Constructor

		private MapsManager()
		{
			Load();
		}

		#endregion

		#region Public Properties

		public static MapsManager Instance
		{
			get 
			{
				lock (typeof(MapsManager))
				{
					if (s_Instance == null)
						s_Instance = new MapsManager();

					return s_Instance;
				}
			}
		}

		#endregion

		#region IMapsManager Members

		public IList<IMap> Items
		{
			get { return _maps; }
		}

		public void Load()
		{
			Items.Clear();
			DataManager.Instance.FillList(Items);
		}

		#endregion
	}
}
